package com.util.cdb.bean;

import com.util.cdb.enums.DataSourceEnum;
import com.util.cdb.enums.MysqlEnum;
import org.springframework.stereotype.Component;

/**
 * @description: MYSQL
 * @author: fengfazheng
 * @create: 2021-12-26 16:48
 **/
@Component
public class MysqlHander extends AbstractHandler {

    @Override
    public String getSql(String operation) {
        return MysqlEnum.getOperationSql(operation);
    }

//    @Override
//    public String getPageSql(QueryOperationPageVO queryOperationPageVO) {
//        String operationSql = MysqlEnum.getOperationSql(queryOperationPageVO.getOperation());
//        String firstNum = String.valueOf(queryOperationPageVO.getPageNo() * queryOperationPageVO.getPageSize());
//        String secondNum = String.valueOf(queryOperationPageVO.getPageSize());
//        return String.format(operationSql, queryOperationPageVO.getTableName(), firstNum, secondNum);
//    }

    @Override
    public String test() {
        System.out.println("test");
        return "test";
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        DataFactory.register(DataSourceEnum.MYSQL.getDbType(), this);
    }
}
